package com.rfid.emergencywarehouse.fragment;

import android.os.Bundle;

import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import androidx.navigation.fragment.NavHostFragment;

import com.rfid.base.base.BaseListFragment;
import com.rfid.emergencywarehouse.R;
import com.rfid.emergencywarehouse.adapter.AssetOrderAdapter;
import com.rfid.emergencywarehouse.entity.AssetOrder;
import com.rfid.emergencywarehouse.entity.BarcodeInfo;
import com.rfid.emergencywarehouse.presenter.GetAssetPresenter;
import com.rfid.emergencywarehouse.view.IGetAssetView;

import java.util.List;

public class GetAssetWithOrderMainFragment extends BaseListFragment<AssetOrderAdapter, AssetOrder, GetAssetPresenter> implements IGetAssetView {

    @Override
    public void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setTitle("我的申请单");
    }

    @Override
    public void onResume() {
        super.onResume();
        mPresenter.getAssetOrderList();
    }

    @Override
    protected AssetOrderAdapter getAdapter() {
        return new AssetOrderAdapter(mData);
    }

    @Override
    protected int getRecyclerViewId() {
        return R.id.recyclerView;
    }

    @Override
    public GetAssetPresenter getPresenter() {
        return new GetAssetPresenter();
    }

    @Override
    protected int getLayoutResId() {
        return R.layout.fragment_get_asset_main;
    }

    @Override
    public void onAssetOrderList(List<AssetOrder> data) {
        setData(data);
    }

    @Override
    public void onDoGetAssetResult(boolean succes, String msg) {
    }

    @Override
    public void onBarcode(String rfid, String barcode) {
    }

    @Override
    public void onBarcodeQuery(BarcodeInfo info,boolean success) {
    }

    @Override
    public void onClick(AssetOrder assetOrder) {
        super.onClick(assetOrder);
        Bundle bundle = new Bundle();
        bundle.putString("kf",assetOrder.getId());
        bundle.putString("id",assetOrder.getId());
        NavHostFragment.findNavController(this).navigate(R.id.action_getAssetWithOrderMainFragment_to_getAssetWithOrderSecondFragment,bundle);

    }
}
